home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 391 < prev    next >
Encoding:
Text File  |  1996-08-06  |  2.5 KB  |  66 lines

  1. Path: engnews1.Eng.Sun.COM!taumet!clamage
  2. From: clamage@Eng.sun.com (Steve Clamage)
  3. Newsgroups: comp.std.c++
  4. Subject: Re: #warning
  5. Date: 20 Feb 1996 21:13:15 GMT
  6. Organization: Sun Microsystems Inc.
  7. Approved: clamage@eng.sun.com (comp.std.c++)
  8. Message-ID: <4gdcvn$cqv@engnews1.Eng.Sun.COM>
  9. References: <4g91rh$kgn@mulga.cs.mu.OZ.AU>
  10. Reply-To: clamage@Eng.sun.com
  11. NNTP-Posting-Host: taumet.eng.sun.com
  12. Content-Type: text
  13. X-Nntp-Posting-Host: taumet.eng.sun.com
  14. Content-Length: 1735
  15. X-Lines: 41
  16. Originator: clamage@taumet
  17.  
  18. In article kgn@mulga.cs.mu.OZ.AU, fjh@munta.cs.mu.OZ.AU (Fergus Henderson) writes:
  19. >clamage@Eng.Sun.COM (Steve Clamage) writes:
  20. >>
  21. >>Yes, you forgot to say how it differs from #error, which is already in the
  22. >>draft (and in Standard C). The description of #error says only that it
  23. >>"causes the implementation to produce a diagnostic message that includes
  24. >>the specified sequence of preprocessing tokens."
  25. >
  26. >Isn't this a bug in the standard?  Doesn't this mean that
  27. >
  28. >    #error foobar
  29. >    int main() { return 0; }
  30. >
  31. >is a strictly conforming program?  Yet no compiler I know of will accept it!
  32.  
  33. It is a strictly conforming program (although we don't use that terminology
  34. in the C++ standard). The implementation must tell you what the effect
  35. of #error is. If the effect is to abort compilation, that is allowed.
  36.  
  37. >Surely the semantics specified for #error should say that it has the effect
  38. >of making the translation unit ill-formed.
  39.  
  40. Why? You can write ill-formed code if you want to. For example:
  41.     #if undesirable_condition
  42.     this phrase should not be seen by the compiler
  43.     #endif
  44.  
  45. The #error directive is part of the language, and I think it would be a
  46. contradiction in terms to say that a valid language construct is ill-formed.
  47.  
  48. "Everyone knows" that the #error directive is supposed to halt compilation,
  49. but for reasons I outlined earlier there isn't a good way (or at least
  50. no one has found a way) to say so in the standard, given the basic
  51. assumptions about what the C++ standard is supposed to be. Other languages
  52. may define a particular environment where you can talk about compilation,
  53. or linking, or known formats of data types, etc, but we have chosen not
  54. to do so with C++.
  55. ---
  56. Steve Clamage, stephen.clamage@eng.sun.com
  57.  
  58.  
  59.  
  60. [ To submit articles: Try just posting with your newsreader.
  61.               If that fails, use mailto:std-c++@ncar.ucar.edu
  62.   FAQ:    http://reality.sgi.com/employees/austern_mti/std-c++/faq.html
  63.   Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html
  64.   Comments? mailto:std-c++-request@ncar.ucar.edu
  65. ]
  66.